{extend name="public:layout" /}

{block name="title"}
	<title>{:site('siteName')}-申请提现</title>
{/block}

{block name="css"}
	<link rel="stylesheet" type="text/css" href="__STATIC__/{$theme}/css/user.css">
	<link rel="stylesheet" href="__STATIC__/share/css/share.css" type="text/css" />
	<style type="text/css">
		#smsTpl { display: none; }
	</style>
{/block}

{block name="content"}
	<div class="layui-main">
		<div class="user-main">
			<div class="user-left">
				{include file="public:user" index="0" /}
			</div>
			<div class="user-right">
				<div class="layui-tab layui-tab-brief">
					<ul class="layui-tab-title">
						<li class="layui-this">申请提现</li>
						<li>
							<a href="/myWithdraw">提现记录</a>
						</li>
					</ul>
					<div class="layui-tab-content">
						<blockquote class="layui-elem-quote layui-quote-nm">提现说明：推荐满{$config.withdrawNum}人允许提现，单次最低提现{$config.minWithdraw}元，最高提现{$config.maxWithdraw}元，提现手续费{$config.withdrawFee}%，提现金额扣除{$config.shopping}%返{:config('currency')['shopping']}，提现金额大于{$config.smsAmount}元需要发送短信验证，开放提现时间每日{$config.withdrawStime}-{$config.withdrawEtime}点。</blockquote>
						<form class="layui-form" action="{:url('index/user/withdraw')}">
							<div class="layui-form-item">
							    <label class="layui-form-label">可提现{:config('currency')['money']}</label>
							    <div class="layui-input-inline">
							    	<button class="layui-btn layui-btn-small layui-btn-radius layui-btn-danger">{$U.money}</button>
							    </div>
							</div>
							<div class="layui-form-item">
				                <label class="layui-form-label">收款方式</label>
				                <div class="layui-input-inline">
				                    <select lay-verify="required" name="type">
				                        <option value="0">支付宝</option>
				                        <option value="1">网银</option>
				                    </select>
				                </div>
				            </div>
							<div class="layui-form-item">
							    <label class="layui-form-label">提现金额</label>
							    <div class="layui-input-inline">
							    	<input type="text" name="money" lay-verify="required|number" class="layui-input">
							    </div>
							    <div class="layui-form-mid layui-word-aux">兑换比例1：1</div>
							</div>
							<div class="layui-form-item">
							    <label class="layui-form-label">支付密码</label>
							    <div class="layui-input-inline">
							    	<input type="password" name="pwd" lay-verify="required" class="layui-input">
							    </div>
							    <div class="layui-form-mid layui-word-aux">请输入支付密码</div>
							</div>
							<div class="layui-form-item" id="smsTpl">
						    	<!-- 短信验证 -->
						    	<a class="layui-btn layui-btn-primary" id="sendSms">发送短信</a>
						  	</div>
						  	<div class="layui-form-item">
							    <label class="layui-form-label">备注</label>
							    <div class="layui-input-inline">
							    	<input type="text" name="note" class="layui-input">
							    </div>
							    <div class="layui-form-mid layui-word-aux">非必填</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label"></label>
							    <div class="layui-input-inline">
							    	<input type="hidden" name="mobile" value="{$U.mobile}" />
							    	<input type="hidden" name="__token__" value="{$Request.token}" />
							    	<button class="layui-btn layui-btn-main" lay-submit>确定</button>
							    </div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
{/block}

{block name="script"}
	<script type="text/javascript">
		layui.use(['jquery','form'], function(){
	
		var $ = layui.jquery;
		var form = layui.form();

		//表单验证
		$("input[name='money']").change(function(e) {
			var html = '<span class="sms-input"><label class="layui-form-label">短信验证</label>\
					    <div class="layui-input-block sms">\
					      	<input type="text" name="code" lay-verify="required|number" placeholder="" class="layui-input">\
					    </div></span>';
			var money = $(this).val();
			var maxMoney = parseInt("{$config.smsAmount}");
			if(money > maxMoney){
				layer.msg('提现金额大于'+maxMoney+'需要短信验证');
				$("#smsTpl").append(html).show();
			}else{
				$(".sms-input").remove();
				$("#smsTpl").hide();
			}
		});

	});
	</script>
{/block}